package cn.exrick.xboot.vip.controller;

import cn.exrick.xboot.core.common.utils.ResultUtil;
import cn.exrick.xboot.core.common.vo.Result;
import cn.exrick.xboot.core.entity.AppMember;
import cn.exrick.xboot.core.service.mybatis.IAppMemberService;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* <p>
    * 会员卡优惠券  前端控制器
    * </p>
*
* @author yuhaifei
* @since 2022-10-09
*/
@RestController
@RequestMapping("/xboot/member")
public class VipMemberController {

    @Autowired
    private IAppMemberService memberService;

    /**
     * 获取用户列表
     * @param condition
     * @return
     */
    @GetMapping("memberList")
    public Result memberList(String condition){
        QueryWrapper<AppMember> wrapper = new QueryWrapper<AppMember>();
        if(StrUtil.isNotBlank(condition)){
            wrapper.like("mobile", condition)
                    .or()
                    .like("nickname", condition);
        }

        return ResultUtil.data(memberService.list(wrapper));
    }

}
